<?php

namespace common\models\merchant;

use common\traits\HasOneMerchant;
use Yii;

/**
 * This is the model class for table "{{%merchant_settle_account_records}}".
 *
 * @property int $id
 * @property string $app_id 应用id
 * @property string $addons_name 插件名称
 * @property int $merchant_id 店铺ID
 * @property int $settle_account_id 结算id
 * @property string $settle_account_serial_number 结算编号
 * @property int $order_id 订单ID
 * @property string $order_sn 订单编号
 * @property int $order_product_id 订单项ID
 * @property string $product_pay_money 订单项实际支付金额
 * @property int $is_refund 是否产生退款
 * @property string $refund_money 实际退款金额
 * @property string $rate 商品平台佣金比率
 * @property string $merchant_money 店铺获取金额
 * @property string $platform_money 平台获取金额
 * @property string $agent_rate 代理商佣金比率
 * @property string $agent_money 代理商佣金
 * @property string $merchant_distribution_money 店铺分销佣金
 * @property int $is_issue 是否已经结算
 * @property string $remark 备注
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 */
class SettleAccountRecords extends \common\models\base\BaseModel
{
    use HasOneMerchant;

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%merchant_settle_account_records}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['merchant_id', 'settle_account_id', 'order_id', 'order_product_id', 'is_refund', 'is_issue', 'created_at', 'updated_at'], 'integer'],
            [['order_id', 'order_product_id'], 'required'],
            [['product_pay_money', 'refund_money', 'rate', 'merchant_money', 'platform_money', 'agent_rate', 'agent_money', 'merchant_distribution_money'], 'number'],
            [['app_id', 'settle_account_serial_number', 'order_sn'], 'string', 'max' => 50],
            [['addons_name'], 'string', 'max' => 100],
            [['remark'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'app_id' => '应用id',
            'addons_name' => '插件名称',
            'merchant_id' => '店铺ID',
            'settle_account_id' => '结算id',
            'settle_account_serial_number' => '结算编号',
            'order_id' => '订单ID',
            'order_sn' => '订单编号',
            'order_product_id' => '订单项ID',
            'product_pay_money' => '订单项实际支付金额',
            'is_refund' => '是否产生退款',
            'refund_money' => '实际退款金额',
            'rate' => '商品平台佣金比率',
            'merchant_money' => '企业收入',
            'platform_money' => '平台获取金额',
            'agent_rate' => '代理商佣金比率',
            'agent_money' => '代理商佣金',
            'merchant_distribution_money' => '店铺分销佣金',
            'is_issue' => '是否已经结算',
            'remark' => '备注',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
        ];
    }
}